検証: PowerShellでイベントビューアーのセキュリティログを取得する
from PowerShellでイベントビューアーのセキュリティログを取得する
Get-EventLogコマンドでイベントを確認できる
セキュリティは詳細を拾えていない…
素Windowsだからっぽい(2022/02/02)
code:cmd.ps
Get-EventLog -list
code:out
Max(K) Retain OverflowAction Entries Log
------ ------ -------------- ------- ---
20,480 0 OverwriteAsNeeded 27,568 Application
20,480 0 OverwriteAsNeeded 0 HardwareEvents
512 7 OverwriteOlder 0 Internet Explorer
20,480 0 OverwriteAsNeeded 0 Key Management Service
Security
20,480 0 OverwriteAsNeeded 41,975 System
15,360 0 OverwriteAsNeeded 11,308 Windows PowerShell
試した環境では権限がない模様
code:cmd.ps
Get-EventLog Security
code:out
Get-EventLog : 要求されたレジストリ アクセスは許可されていません。
発生場所 行:1 文字:1
+ Get-EventLog Security
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) Get-EventLog, SecurityException
+ FullyQualifiedErrorId : System.Security.SecurityException,Microsoft.PowerShell.Commands.GetEventLogCommand
PowerShellを管理者として実行してみる
code:cmd.ps
Get-EventLog -list
code:out
Max(K) Retain OverflowAction Entries Log
------ ------ -------------- ------- ---
20,480 0 OverwriteAsNeeded 27,568 Application
20,480 0 OverwriteAsNeeded 0 HardwareEvents
512 7 OverwriteOlder 0 Internet Explorer
20,480 0 OverwriteAsNeeded 0 Key Management Service
20,480 0 OverwriteAsNeeded 27,855 Security
20,480 0 OverwriteAsNeeded 41,975 System
15,360 0 OverwriteAsNeeded 11,276 Windows PowerShell
取れるっぽい
code:cmd.ps
Get-EventLog Security
code:out
Index Time EntryType Source InstanceID Message
----- ---- --------- ------ ---------- -------
221185 9 04 11:24 SuccessA... Microsoft-Windows... 4624 アカウントが正常にログオンしました。...